{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import geopandas as gpd\n",
    "import geoviews as gv\n",
    "import cartopy.crs as ccrs\n",
    "\n",
    "gv.extension('bokeh')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Define data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "tiles = gv.tile_sources.Wikipedia\n",
    "\n",
    "# Project data to Web Mercator\n",
    "nybb = gpd.read_file(gpd.datasets.get_path('nybb'))\n",
    "poly_data = nybb.to_crs(ccrs.GOOGLE_MERCATOR.proj4_init)\n",
    "polys = gv.Polygons(poly_data, vdims=['BoroName'], crs=ccrs.GOOGLE_MERCATOR)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "tiles * polys.opts(color='BoroName', cmap='Category20', width=800, height=600, tools=['hover', 'tap'])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
